package com.channelsoft.cm.application;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ImageView;
import android.widget.ListAdapter;
import android.widget.ListView;
import android.widget.SimpleAdapter;

public class VoiceActivity extends Activity {
	private ListView listView;
	private List<Map<String, Object>> data;
	private Intent intent;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.voice_service);
		listView = (ListView) findViewById(R.id.voice_service_list);
		data = getDataList();
		ListAdapter adapter = new SimpleAdapter(this, data,
				R.layout.voice_item, new String[] { "pic" },
				new int[] { R.id.voiceItem_img }) {
			@Override
			public void setViewImage(ImageView v, int value) {
				super.setViewImage(v, value);
			}
		};
		listView.setDividerHeight(0);
		listView.setAdapter(adapter);
		listView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				switch (position) {
				case 0:
					intent = new Intent();
					intent.setClass(VoiceActivity.this,
							ClientCheckActivity.class);
					startActivity(intent);
					break;
				}
			}
		});

	}

	public List<Map<String, Object>> getDataList() {
		List<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
		Map<String, Object> map = new HashMap<String, Object>();
		map.put("pic", R.drawable.yy_xyyw);
		data.add(map);
		map = new HashMap<String, Object>();
		map.put("pic", R.drawable.yy_szx17951);
		data.add(map);
		map = new HashMap<String, Object>();
		map.put("pic", R.drawable.yy_hjh);
		data.add(map);
		return data;
	}
}
